<template>
 <div>
  <ul>
    <li v-for="(item,index) in list" :key="index" @click="del(item.id)">{{item.num}}  删除</li>
  </ul>
  <button @click="run()">生成</button>
 </div>
</template>

<script>
 export default {
   name: 'App',
   data () {
     return {
      list:[],
     }
   },
   methods:{
   run(){
    const num = Math.floor(Math.random()*(20-0+1))+0
    const id = + new Date()
    const obj = {
      id,
      num,
    }
    this.list.push(obj)
   },
   del(id){
    console.log(id);
    this.list = this.list.filter((item)=>{return item.id !== id})
   }
   }
 }
</script>

<style>

</style>